<template>
	<view class="container">
		<!-- 头部安全距离 -->
		<view class="status_bar"></view>
		<view class="cover">
			<image :src="nftGoodsInfo.preview"></image>
		</view>
		<!-- 信息展示 -->
		<view class="order margin-b30">
			<view class="title margin-b30">
				{{nftGoodsInfo.goodsName}}
			</view>
			<view class="flex-row margin-b30">
				<view class="">系列</view>
				<view class="">无系列</view>
			</view>
			<view class="flex-row margin-b30">
				<view class="">单价</view>
				<view class="">{{nftGoodsInfo.price}}</view>
			</view>
			<view class="flex-row margin-b30">
				<view class="">合约地址</view>
				<view class="info_approve_contract">
					<text class="info">wsxookmmi88999123xonxox</text>
					<image style="width: 20px;height: 20px;" src="../../static/images/nft/copy.png"></image>
				</view>
			</view>
			<view class="flex-row">
				<view class="">认证网络</view>
				<view class="">Conflux</view>
			</view>
		</view>
		<!-- 数量展示 -->
		<view class="num">
			<!-- <view class="flex-row margin-b30">
				<view class="">购买数量</view>
				<u-number-box v-model="buyNum" @change="changeBuyNum"></u-number-box>
			</view> -->
			<view class="flex-row">
				<view class="">{{ buyNum }}件商品，商品总金额</view>
				<view class="">¥{{nftGoodsInfo.price}}</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="bottom_btn_card">
			<view class="bottom_btn_card_left">
				<view class="price">¥{{nftGoodsInfo.price}}</view>
			</view>
			<view class="">
				<u-button text="立即购买" color="var(--echo-main-color)" @tap="toPay(nftGoodsInfo.serialNo,nftGoodsInfo.price)" class="bottom_btn"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNftGoodsDetail
	} from '@/config/nft.js';
	export default {
		data() {
			return {
				nftGoodsInfo: {},
				buyNum: 1
			}
		},
		onLoad({
			serialNo
		}) {
			console.log(serialNo);
			// NFT详情
			getNftGoodsDetail({serialNo}).then(res => {
				this.nftGoodsInfo = res.data
			})
		},
		methods: {
			// 购买数量
			changeBuyNum(e) {},
			// 支付
			toPay(serialNo,price) {
				uni.navigateTo({
					url: `/pages/Nft/PayNft?serialNo=${serialNo}&price=${price}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		min-height: 100vh;
		background: $echo-nft-bg-color;
		color: #fff;
		padding: 0 20rpx;

		// 顶部安全距离
		.status_bar {
			height: var(--status-bar-height);
		}

		// 封面
		.cover {
			width: 100%;
			height: 100%;
			text-align: center;
			padding: 40rpx 0px;
			uniImage {
				width: 100%;
				height: 100%;
				background-size: contain !important;
				background-repeat: no-repeat !important;;
			}
		}

		// 订单
		.order {
			background-color: $echo-nft-card-bg-color;
			padding: 30rpx;
			border-bottom-left-radius: 10rpx;
			border-bottom-right-radius: 10rpx;

			// 地址
			.info_approve_contract {
				display: flex;

				.info {
					width: 400rpx;
					/*1.强制不换行*/
					white-space: nowrap;
					/*2.溢出隐藏*/
					overflow: hidden;
					/*3.超出部分用省略号表示*/
					text-overflow: ellipsis;
				}
			}
		}

		// 数量
		.num {
			background-color: $echo-nft-card-bg-color;
			padding: 30rpx;
			border-radius: 10rpx;
		}

		// 底部按钮
		.bottom_btn_card {
			width: 100%;
			box-sizing: border-box;
			position: fixed;
			bottom: 0;
			left: 0;
			padding: 0 60rpx;
			height: 110rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			background-color: $echo-nft-card-bg-color;
			font-size: 28rpx;

			&_left {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.price {
					font-size: 44rpx;
					color: $echo-main-color;
					margin-left: 20rpx;
				}
			}

			.bottom_btn {
				border-radius: 40rpx;
				width: 200rpx;
			}
		}

		.flex-row {
			display: flex;
			justify-content: space-between;
			align-items: center;
		}
	}
</style>
